<template>
	<view class="content">
		<view class="header">
			<view class="name-tit">张三 您好：</view>
			<textarea class="head-cont" v-model="content" maxlength="9999" ></textarea>
		</view>
		<view class="mid-line"></view>
		<view class="cont-box" @click="jobShow=true">
			<view>面试岗位</view>
			<input class="cont-cont-tit" v-model="job_name" placeholder="请输入面试岗位"></input>
			<u-select mode="single-column" v-model="jobShow" :list="jobList" @confirm="confirm"></u-select>
		</view>
		<view class="down-line"></view>
		<view class="bot-btn">
			<button @click="sendYaoqing()">发送邀请</button>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				id:'',
				job_id:'',
				job_name:'',
				jobList:[],
				content:'',
				jobShow:false
			}
		},
		onLoad(e) {
			this.id=e.user_id
			this.content="经过我司HR的初步筛选，认为你与我们的职位要求匹配，现诚挚邀请你来我司面谈。"
			this.getJob()
		},
		methods: {
			async sendYaoqing() {
				const res = await this.get('/Index/UserCompany/send_invite',{'user_id':this.id,'job_id':this.job_id,'content':this.content})
				if(res.code==200){
					uni.showToast({
						title:'邀请成功',
						icon:'none',
						success() {
							setTimeout(() => {
							    uni.navigateTo({
							    	url:'school_recruit'
							    })
							},1000);
						}
					})
				}
			},
			async getJob() {
				const res = await this.get('/index/UserCompany/get_company_job_key')
				res.data.forEach((item,i)=>{
					this.jobList.push({value:item.id,label:item.job_name})
				})
			},
			confirm(e){
				this.job_id=e[0].value;
				this.job_name=e[0].label;
			}
		}
	}
</script>

<style lang="scss" scoped>
	.content{
		.header{
			.name-tit{
				color: #101010;
				font-size: 34upx;
				font-weight: bold;
				padding: 28upx 0 20upx 24upx;
			}
			.head-cont{
				color: #C2C7CC;
				width: 702upx;
				font-size: 30upx;
				margin-left: 24upx;
			}
		}
		.mid-line{
			background: #F6F6F6;
			height: 20upx;
		}
		.cont-box{
			display: flex;
			justify-content: space-between;
			font-size: 28upx;
			padding: 20upx 25upx;
			.cont-cont-tit{
				width: 80%;
				color: #999898;
				font-size: 28upx;
				text-align: right;
			}
		}
		.down-line{
			border: 2upx solid #dddddd;
			margin: 8upx 0;
		}
		.bot-btn{
			padding: 10upx 20upx;
			button{
				width: 100%;
				color: #FFFFFF;
				background: #3291F8;
			}
		}
	}
</style>
